package cn.nicklemay.interview.designpattern.Observe;

import java.util.ArrayList;
import java.util.List;

public class Singnal {
    private List<Observe> observes = new ArrayList<>();

    public void add(Observe observe) {
        observes.add(observe);
    }

    public void say(String s) {
        observes.forEach(o -> o.sayHi(s));
    }

    public static void main(String[] args) {
        Singnal s = new Singnal();

        Observe observe1 = new Aobserve();
        Observe observe2 = new Bobserve();

        s.add(observe1);
        s.add(observe2);

        s.say("666");
        s.say("123");
    }
}
